<script>
xe.lang.msg_empty_search_target = '{$lang->msg_empty_search_target}';
xe.lang.msg_empty_search_keyword = '{$lang->msg_empty_search_keyword}';
</script>
<load target="js/trackback_admin.js" usecdn="true" />
<form action="">
	<div class="x_page-header">
		<h1>{$lang->trackback} <a class="x_icon-question-sign" href="./admin/help/index.html#UMAN_content_trackback" target="_blank">{$lang->help}</a></h1>
	</div>
	<div cond="$XE_VALIDATOR_MESSAGE && $XE_VALIDATOR_ID == 'modules/trackback/tpl/trackback_list/1'" class="message {$XE_VALIDATOR_MESSAGE_TYPE}">
		<p>{$XE_VALIDATOR_MESSAGE}</p>
	</div>
	<table width="100%" id="trackbackListTable" class="x_table x_table-striped x_table-hover">
		<caption>
			<strong>{$lang->all}({number_format($total_count)})</strong>
			<span class="x_pull-right">
				<a href="#listManager" class="x_btn modalAnchor" onclick="getTrackbackList();">{$lang->delete}</a>
			</span>
		</caption>
		<thead>
			<tr>
				<th scope="col">{$lang->title}</th>
				<th scope="col" class="nowr">{$lang->site}</th>
				<th scope="col" class="nowr">{$lang->date}</th>
				<th scope="col" class="nowr">{$lang->ipaddress}</th>
				<th scope="col"><input type="checkbox" title="Check All" /></th>
			</tr>
		</thead>
		<tbody>
			<tr loop="$trackback_list => $no, $val">
				<td>
					<a href="{getUrl('','document_srl',$val->document_srl)}#trackback_{$val->trackback_srl}" target="_blank">{htmlspecialchars($val->title)}</a>
					<p>{$val->excerpt}</p>
				</td>
				<td class="nowr"><a href="{$val->url}" target="_blank">{htmlspecialchars($val->blog_name)}</a></td>
				<td class="nowr">{zdate($val->regdate,"Y-m-d")}</td>
				<td class="nowr"><a href="{getUrl('search_target','ipaddress','search_keyword',$val->ipaddress)}">{$val->ipaddress}</a></td>
				<td><input type="checkbox" name="cart" value="{$val->trackback_srl}" /></td>
			</tr>
		</tbody>
	</table>
	<div class="x_pull-right">
		<a href="#listManager" class="x_btn modalAnchor" onclick="getTrackbackList();">{$lang->delete}</a>
	</div>
</form>
<form action="" class="x_pagination">
	<input type="hidden" name="error_return_url" value="" />
	<input type="hidden" name="module" value="{$module}" />
	<input type="hidden" name="act" value="{$act}" />
	<input cond="$search_keyword" type="hidden" name="search_keyword" value="{$search_keyword}" />
	<input cond="$search_target" type="hidden" name="search_target" value="{$search_target}" />
	<ul>
		<li class="x_disabled"|cond="!$page || $page == 1"><a href="{getUrl('page', '')}">&laquo; {$lang->first_page}</a></li>
		<block cond="$page_navigation->first_page != 1 && $page_navigation->first_page + $page_navigation->page_count > $page_navigation->last_page - 1 && $page_navigation->page_count != $page_navigation->total_page">
		{@$isGoTo = true}
		<li>
			<a href="#goTo" data-toggle title="{$lang->cmd_go_to_page}">&hellip;</a>
			<span cond="$isGoTo" id="goTo" class="x_input-append">
				<input type="number" min="1" max="{$page_navigation->last_page}" required name="page" title="{$lang->cmd_go_to_page}" />
				<button type="submit" class="x_add-on">Go</button>
			</span>
		</li>
		</block>

		<!--@while($page_no = $page_navigation->getNextPage())-->
		{@$last_page = $page_no}
		<li class="x_active"|cond="$page_no == $page"><a  href="{getUrl('page', $page_no)}">{$page_no}</a></li>
		<!--@end-->

		<block cond="$last_page != $page_navigation->last_page && $last_page + 1 != $page_navigation->last_page">
		{@$isGoTo = true}
		<li>
			<a href="#goTo" data-toggle title="{$lang->cmd_go_to_page}">&hellip;</a>
			<span cond="$isGoTo" id="goTo" class="x_input-append">
				<input type="number" min="1" max="{$page_navigation->last_page}" required name="page" title="{$lang->cmd_go_to_page}" />
				<button type="submit" class="x_add-on">Go</button>
			</span>
		</li>
		</block>
		<li class="x_disabled"|cond="$page == $page_navigation->last_page"><a href="{getUrl('page', $page_navigation->last_page)}" title="{$page_navigation->last_page}">{$lang->last_page} &raquo;</a></li>
	</ul>
</form>
<form action="" class="search center x_input-append">
	<input type="hidden" name="module" value="{$module}" />
	<input type="hidden" name="act" value="{$act}" />
	<input type="hidden" name="module_srl" value="{$module_srl}" />
	<input type="hidden" name="error_return_url" value="" />
	<select name="search_target" title="{$lang->search_target}" style="margin-right:4px">
		<!--@foreach($lang->search_target_list as $key => $val)-->
		<option value="{$key}" <!--@if($search_target==$key)-->selected="selected"<!--@end-->>{$val}</option>
		<!--@end-->
	</select>
	<input type="search" name="search_keyword" value="{htmlspecialchars($search_keyword)}" />
	<button type="submit" class="x_btn x_btn-inverse">{$lang->cmd_search}</button>
	<a class="x_btn" href="{getUrl('','module',$module,'act',$act)}">{$lang->cmd_cancel}</a>
</form>
<form ruleset="deleteChecked" action="./" method="post" class="x_modal" id="listManager">
	<input type="hidden" name="module" value="trackback" />
	<input type="hidden" name="act" value="procTrackbackAdminDeleteChecked" />
	<input type="hidden" name="page" value="{$page}" />
	<input type="hidden" name="xe_validator_id" value="modules/trackback/tpl/trackback_list/1" />
	<div class="x_modal-header">
		<h1>{$lang->trackback_manager}: {$lang->delete}</h1>
	</div>
	<div class="x_modal-body">
		<table id="trackbackManageListTable" class="x_table x_table-striped x_table-hover">
			<caption>
				<strong>{$lang->selected_trackback} <span id="selectedTrackbackCount"></span></strong>
			</caption>
			<thead>
				<tr>
					<th scope="col" class="title"><span>{$lang->title}</span></th>
					<th scope="col">{$lang->site}</th>
				</tr>
			</thead>
			<tbody>
			</tbody>
		</table>
	</div>
	<div class="x_modal-footer">
		<button type="submit" class="x_btn x_btn-inverse">{$lang->cmd_delete}</button>
	</div>
</form>
<script>
jQuery(function($){
	// Modal anchor activation
	var $docTable = $('#trackbackListTable');
	$docTable.find(':checkbox').change(function(){
		var $modalAnchor = $('a.modalAnchor');
		if($docTable.find('tbody :checked').length == 0){
			$modalAnchor.removeAttr('href').addClass('x_disabled');
		} else {
			$modalAnchor.attr('href','#listManager').removeClass('x_disabled');
		}
	}).change();
	// Modal anchor button action
	$('a.modalAnchor').bind('before-open.mw', function(){
		if($docTable.find('tbody :checked').length == 0){
			$('body').css('overflow','auto');
			alert('{$lang->msg_cart_is_null}');
			return false;
		}
	});
});
</script>